<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    <title>教学日历</title>
    <%@include file="../common/common.jsp" %>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	

  </head>
  
  <body>
  	<form name="frm" class="form-inline definewidth m20" action="process/queryCalendarDetail.do" method="post">
  		<button type="button" class="btn btn-primary" id="btnRef">刷新</button>
	    <button type="button" class="btn btn-info" id="btnPrint">打印</button>
	    <button type="button" class="btn btn-success" id="btnAdd">新增</button>
	    <button type="button" class="btn" name="backid" id="btnBack">返回列表</button>
	    &nbsp;&nbsp;<span class="label label-important" style="padding: 8px;" ><span class="x-icon x-icon-warning"> √ </span>课程名称:<span id="course_name"></span></span>
		<input type="hidden" name="calendar_id" id="calendar_id" value="${param.calendar_id}">
	</form>
	<c:set var="course_name"></c:set>
	<table class="table table-bordered table-hover definewidth m10">
	    <thead>
		    <tr>
		        <th>序号</th>
		        <th>周次</th>
		        <th>讲课内容<br>（教学大纲分章和题目的名称）</th>
		        <th>课堂时数</th>
		        <th>课外时数</th>
		        <th>习题课、课堂讨论、课程练习、测验的内容</th>
		        <th>课堂时数</th>
		        <th>课外时数</th>
		        <th>实验名称、课程作业、作图、课程设计的名称及现场教学</th>
		        <th>课堂时数</th>
		        <th>课外时数</th>
		        <th>书籍</th>
		        <th>操作</th>
		    </tr>
	    </thead>
		<tbody>
			<c:forEach items="${list }" var="info" varStatus="i">
				<c:set var="course_name" value="${info.course_name }"></c:set>
				<tr>
					<td>${i.index}</td>		
					<td>${info.week}</td>
					<td>${info.course_content}</td>
					<td>${info.course_kt_hour}</td>
					<td>${info.course_kw_hour}</td>
					<td>${info.test_content}</td>
					<td>${info.test_kt_hour}</td>
					<td>${info.test_kw_hour}</td>
					<td>${info.lab_content}</td>
					<td>${info.lab_kt_hour}</td>
					<td>${info.lab_kw_hour}</td>
					<td>${info.books}</td>
					<td>
						<a href="javascript:void(0)" onclick="editDetail('${info.id}')">编辑</a>
					</td>
		        </tr>
			</c:forEach>
		</tbody>	
	</table>
	<script type="text/javascript">
		$(function (){
			$("#course_name").html("${course_name}");
			$("#btnPrint").click(function (){
				var id=$("#calendar_id").val();
				window.open("process/queryCalendarDetail.do?action=print&calendar_id="+id+"&course_name=${course_name}");
			});
			$("#btnRef").click(function (){
				document.frm.submit();
			});
			$("#btnAdd").click(function (){
				var id=$("#calendar_id").val();
				window.location.href="<%=basePath%>process/calendarDetailEdit.jsp?action=add&calendar_id="+id;
			});
			$("#btnBack").click(function (){
				var id=$("#calendar_id").val();
				window.location.href="<%=basePath%>process/queryCalendar.do";
			});
		});
		
		
		function editDetail(id){
			var calendar_id=$("#calendar_id").val();
			window.location.href="<%=basePath%>process/toEditCalendarDetail.do?action=update&calendar_id="+calendar_id+"&id="+id;
		}
	</script>
  </body>
</html>
